home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / mf-db.zip / MF.H < prev    next >
C/C++ Source or Header  |  1993-11-24  |  7KB  |  233 lines

  1. /*     -------------------------------------------------------------------
  2.     MF Database Header File 
  3.     This API header file is copyrighted 1993 by Carl Brown.
  4.     You may only use this in conjunction with the MF database.
  5.     ------------------------------------------------------------------- */
  6.  
  7.     /*    Since most people add something like this anyway...    */
  8. #ifndef MFHEADER
  9. #define MFHEADER
  10.  
  11.  
  12.     /* C plus plus 'warning' and 'error' fixer... */
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif    /* c++ */
  17.  
  18.  
  19.  
  20.     /*----------
  21.          Structures 
  22.       ----------*/
  23.        /* 
  24.            Used for defining external dll extensions on mfInit  
  25.        */
  26. typedef struct {
  27.    int   extType;             /* Type of extension       */
  28.    char  extDLLName[128];     /* Name of DLL extension   */
  29. } tmfExtDLL;
  30. typedef tmfExtDLL FAR * ptmfExtDLL;
  31.  
  32.  
  33.    /* 
  34.       Currently supported DLL extensions
  35.    */
  36. #define     EXT_UDK        0         /* value for a UDK extension DLL     */
  37. #define     EXT_UDK_NAME   "mfUDK"    /* Function in the DLL                */
  38.  
  39.  
  40.  
  41.    /* 
  42.           Constant variable sizes for prototypes and calls
  43.       
  44.         note:  These MAY change to unsigned longs to support DB's up to
  45.         4GB's (as opposed to 2GB's...)  Try to use these as your parameters
  46.         where they are shown in the API calls...
  47.         
  48.         Also, other OS releases are in the works and 'int' will lose its 
  49.         usefulness.
  50.    */
  51. #define     RPTR        long
  52. #define     IPTR        long
  53.  
  54.     /*    
  55.         As opposed to the LPSTR, we use FPDATA.  Maybe we should have used a VOID
  56.         pointer -- but, that's not the case.  It works either way and makes the math
  57.         a little simpler...
  58.     */
  59. #define     FPDATA      char FAR *
  60.  
  61.     /* 
  62.         Handle to a MF database 
  63.         and MF Task
  64.     */
  65. #define     hMF_DB      int
  66. #define        hMF_TASK    int
  67.  
  68.    /* ----------------
  69.       SEEK information
  70.       ---------------- */
  71. #define MFSEEK_BOF      -1
  72. #define MFSEEK_EOF      -2
  73. #define MFSEEK_NODATA   -3
  74.  
  75.        /* 
  76.        iCode (passed integer) RETURN values 
  77.     */
  78. #define MFSEEK_EXACT_MATCH      1
  79. #define MFSEEK_PARTIAL_MATCH    2
  80.  
  81.  
  82.    /* 
  83.    Compare Information (Index sort orders)  
  84.    */
  85. #define MFCOMP_CHAR     1        /*     Alpha string - case sensitive                 */
  86. #define MFCOMP_INT      2        /*     Short Integer or Short Integer array        */
  87. #define MFCOMP_LONG     3        /*    Long or Long array                            */
  88. #define MFCOMP_CHARIC   4        /*     Alpha string - case insensitive             */
  89. #define MFCOMP_UDK      100       /* Or greater                                     */
  90.  
  91.  
  92.    /* 
  93.       READ/WRITE options
  94.    */
  95. #define MFRW_ALL        -1
  96. #define MFRW_DATA       -2
  97. #define MFRW_KEY        -3
  98. /*
  99. #define MFRW_KEYEXACT   0 // Index # to write for a KEYEXACT (unsupported in this release) 
  100. */
  101.  
  102.    /*
  103.        Severe-Performance options
  104.    */
  105. #define MF_SP_COUNT     -1
  106.  
  107.  
  108. /*
  109.     ERRORS RETURNED
  110. */
  111.     /* Open */
  112.     #define mfERR_OPEN_UNDEFINED      -10
  113.     #define mfERR_OPEN_NOHNDLS        -11
  114.     #define mfERR_OPEN_INVALIDFILE    -12
  115.     #define mfERR_OPEN_INVALIDFORMAT  -14
  116.     #define mfERR_OPEN_NO_DBINIFILE   -15
  117.     #define mfERR_OPEN_UDK_NOT_FOUND  -16
  118.     #define mfERR_OPEN_INDEXMISSING      -17
  119.  
  120.     /* Close  */
  121.     #define mfERR_CLOSE_BAD           -21
  122.  
  123.     /* Write  */
  124.     #define mfERR_WRITE_BADRECORD     -31
  125.     #define mfERR_WRITE_NOLOCK        -32
  126.  
  127.     /* Read  */
  128.     #define mfERR_READ_BADRECORD      -41
  129.     
  130.     /* Append */
  131.     #define mfERR_APPEND_NOADD        -51
  132.  
  133.     /* Register  */
  134.     #define mfERR_REG_NOTASKS         -61
  135.     #define mfERR_INIT_UDK_NOT_FOUND  -16
  136.  
  137.  
  138.     /* CreateDB  */
  139.     #define mfERR_CREATEDB_BADFILE    -71
  140.     #define mfERR_CREATEDB_BADRECSIZE -72
  141.  
  142.  
  143.     /* Create Index */
  144.     #define mfERR_CREATEINDEX_BADFILE -81
  145.  
  146.     /*   Update Index  */
  147.     #define mfERR_UPDINDEX_BADSEQ     -91
  148.     #define mfERR_X_NOOLDKEY          -92
  149.     #define mfERR_X_NOADDKEY          -93
  150.  
  151.     /* Splits */
  152.     #define mfERR_SPLIT_NOROOM        -101
  153.     
  154.     /* Delete */
  155.  
  156.     
  157.  
  158.     /* GENERAL   */
  159.     #define mfERR_EOF                 -2
  160.     #define mfERR_BOF                 -1
  161.           /*
  162.          These usually generate if you haven't been 
  163.          verifying your RETURN codes...(They tell you
  164.          that you passed a NEGATIVE value as a parameter...)
  165.         */
  166.     #define mfERR_BAD_TASKSELECTOR    -220
  167.     #define mfERR_BAD_HNDLSELECTOR    -221
  168.     #define mfERR_BAD_INDEXSELECTOR   -222
  169.     #define mfERR_BAD_EVERYTHING      -223
  170.     
  171.     /* 
  172.         Global errors (could occur from most calls...)  
  173.     */
  174.     #define mfERR_RECORD_DELETED       -300
  175.     
  176.  
  177.  
  178.  
  179. /*     ----------
  180.        Prototypes
  181.     ---------- */
  182.     /* 
  183.            Data Manipulation 
  184.        */
  185. int  FAR PASCAL _export mfWrite(RPTR Record, FPDATA dFill, hMF_TASK Task, hMF_DB dbHndl, int Option );
  186. int  FAR PASCAL _export mfRead (RPTR Record, FPDATA dFill, hMF_TASK Task, hMF_DB dbHndl, int Option );
  187. int  FAR PASCAL _export mfDelete(RPTR Record, hMF_TASK Task, hMF_DB dbHndl);
  188. RPTR FAR PASCAL _export mfAppendData(FPDATA dFill, hMF_TASK Task, hMF_DB dbHndl);
  189.  
  190.        /* 
  191.            Movement 
  192.        */
  193. RPTR FAR PASCAL _export mfSeek(FPDATA SkStr, int FAR * Code, hMF_TASK Task, hMF_DB dbHndl, int iHndl);
  194. RPTR FAR PASCAL _export mfSkip(RPTR record, long NumSkip, hMF_TASK Task, hMF_DB dbHndl, int idxNumber);
  195. RPTR FAR PASCAL _export mfTop(hMF_TASK Task, hMF_DB dbHndl, int idxNumber);
  196. RPTR FAR PASCAL _export mfBottom(hMF_TASK Task, hMF_DB dbHndl, int idxNumber);
  197.  
  198.        /* 
  199.            Creation 
  200.        */
  201. int FAR PASCAL _export mfCreateIndex(LPSTR FileName, int RecSize, int DataType, int NumOfIndexes);
  202. int FAR PASCAL _export mfCreateDB(LPSTR FileName, int dRecSize, int NumIndex, int FAR * iRecSize, int FAR * iType);
  203.  
  204.        /* 
  205.            General stuff  
  206.        */
  207. int FAR PASCAL _export mfInfoDB(int FAR * RecSize, int FAR * NumIndexs, RPTR FAR * NumRecs, RPTR FAR * RealRecs, hMF_TASK Task, hMF_DB Hndl);
  208. int FAR PASCAL _export mfInfoIndex(hMF_TASK Task, hMF_DB dbHndl, int iHndl);
  209. int FAR PASCAL _export mfIsDeleted (RPTR Record, hMF_TASK Task, hMF_DB Hndl);
  210. int FAR PASCAL _export mfReIndex(HWND hDisplay, hMF_TASK Task, hMF_DB Hndl);
  211. int FAR PASCAL _export mfLock(RPTR record, hMF_TASK Task, hMF_DB db);
  212. int FAR PASCAL _export mfUnLock(RPTR record, hMF_TASK Task, hMF_DB db);
  213.  
  214.  
  215.        /* 
  216.            Administrative 
  217.        */
  218. hMF_DB         FAR PASCAL _export mfOpen( LPSTR FileName, hMF_TASK Task);
  219. int         FAR PASCAL _export mfClose(hMF_TASK Task, hMF_DB dbHndl);
  220. hMF_TASK    FAR PASCAL _export mfInit(ptmfExtDLL szExtCalls);
  221. int         FAR PASCAL _export mfDeInit(hMF_TASK Task);
  222.  
  223.  
  224.        /* 
  225.            Severe-performance functions  
  226.        */
  227. long FAR PASCAL _export mfReadList(RPTR record, FPDATA passStr, int FuzzyMatch, RPTR FAR * hitList, long MaxNumHitsWanted, hMF_TASK Task, hMF_DB dbHndl, int iHndl);
  228.  
  229. #ifdef __cplusplus
  230. }
  231. #endif    /* C++ */
  232.  
  233. #endif    /* MFHEADER */